Achieve 80% to pass. Wherever necessary, you are free to check the documentation of the Python packages when answering the questions.

 

  1. Consider the following code

    import numpy as np
    arr = np.arange(6).reshape([2,3])

    What does the array arr look like?
    1. [[6,6,6]
      [6,6,6]]
    2. [[1,2]
      [3,4]
      [5,6]]
    3. [[0,1,2]
      [3,4,5]]
    4. [[1,2,3]
      [4,5,6]]


 

  1. I want to make a numpy array with the shape of 2 rows and 5 columns and every element of the array is 0. The library numpy is imported as np. Which of the following commands is(are) NOT correct? 
    1. np.zeros([2,5])
    2. np.array([[0,0,0,0,0], [0,0,0,0,0]])
    3. np.zeros((2,5))
    4. np.zeros([5,2])

 

 

  1. What is the output of the following command?

    np.array([1,2,3])*np.array([[4],[5],[6]])
     
    1. [[4,10,18]]
    2. [[4,8,12],
      [5,10,15],
      [6,12,18]]
    3. [[4,5,6],
      [8,10,12],
      [12,15,18]]
    4. 32

 

 

  1. Given that the variable arr is a numpy array with a dimension of (5,7,10,2). Consider the following command.

    arr[1:3,1,::2]

    Which one of the following commands produces the same result as the command shown above?
    1. arr[1:3,1:,::2]
    2. arr[,1:3,1,::2]
    3. arr[slice(1,3,None),1,slice(None,None,2)]
    4. arr[slice(1,3),1,slice(2)]

 

 

  1. Which of the following methods can be used to create a new xarray Dataset object? The xarray library is imported as xr.
    1. xr.open_dataset()
    2. xr.open_mfdataset()
    3. xr.Dataset()
    4. All of the above

 

 

  1. Which of the following is NOT a method to create a subset of an xarray DataArray object?
    1. .plot() method
    2. Boolean indexing
    3. .sel() method
    4. .groupby() method

 

 

  1. I have a DataArray object da with dimensions of longitude (in degreeE) and latitude (in degreeN). Which of the following commands is the correct one to select data in the latitude range of 30 degreeN to 45 degreeN?
    1. da.sel(latitude=slice(30,45))
    2. da.isel(latitude=slice(30,45))
    3. da.sel(latitude=[30:45])
    4. da.isel(latitude=[30:45])

 

 

  1. I have an xarray Dataset object ds with variable t2m. The dimension of the object is (time, latitude, longitude). Which of the following commands is the correct one to calculate the seasonal mean of t2m?
    1. ds.groupby().mean("time.season")
    2. ds.groupby("time.season").mean()
    3. ds.mean().groupby("time.season")
    4. ds.mean("time.season").groupby()

 

 

  1. Which of the following is the correct method to create a Figure object using matplotlib? The library matplotlib.pyplot is imported as plt.
    1. plt.figure()
    2. plt.Figure()
    3. plt.subplots()
    4. All of the above

 

 

  1. How do you customize the color of a line plot in matplotlib?
    1. Specify the ‘color’ argument in the plt.plot() function
    2. Specify the ‘color’ argument in the plt.line() function
    3. Using the plt.color() function
    4. Using the plt.set_color() function

 

 

  1. How do you add a colorbar to a contour plot in matplotlib?
    1. Using the plt.add_colorbar() function
    2. Using the plt.add_legend() function
    3. Using the plt.colorbar() function
    4. Specify the ‘colorbar’ argument in the plt.contour() function

 

 

  1. How do you add a legend to a line plot in matplotlib?
    1. Legend is always added automatically by matplotlib
    2. Using the plt.legend() function
    3. Using the plt.annotate() function
    4. Specify a ‘legend’ argument in the plt.plot() function

 

 

  1. Which of the following can NOT be used to visualize 2D vector data in matplotlib?
    1. plt.quiver()
    2. plt.contourf()
    3. plt.barbs()
    4. plt.streamplot()

 

 

  1. Which of the following statements is correct about the hvplot library?
    1. hvplot can be used to create interactive plots
    2. hvplot is built on matplotlib
    3. hvplot is only able to plot xarray Dataset object
    4. All of the above

 

 

  1. Which of the following kinds of plots are NOT supported by hvplot (as of the version this question is asked, v0.8.5)?
    1. Contour plot
    2. Histogram
    3. Streamline plot
    4. Heatmap

 

 

Previous   Answer